5.2 Viz 2M-Mouse-Atlas Downsampled

In [1]:
from clustergrammer2 import net
df = {}
>> clustergrammer2 backend version 0.5.1
In [2]:
import pandas as pd
from ast import literal_eval as make_tuple
import warnings
warnings.filterwarnings('ignore')
In [3]:
df_ds = pd.read_parquet('../data/cao_2million-cell_2019_61-embryo_downsample/cao_embryo_cell-type_downsample.parquet')
df_ds.columns = [make_tuple(x) for x in df_ds.columns.tolist()]
df_ds.shape
Out[3]:
(5000, 2229)
In [4]:
ser_cell_types = pd.Series([x[1].split(': ')[1] for x in df_ds.columns.tolist()])

Cell Type Distributions

In [5]:
cell_type_dist = pd.read_csv('../data/cao_2million-cell_2019_61-embryo_downsample/cell_type_dist.txt', sep='\t', index_col=0, header=None)
print(cell_type_dist)
                                    1
0                                    
Chondrocytes & osteoblasts     104698
Connective tissue progenitors   98964
Intermediate Mesoderm           89518
Jaw and tooth progenitors       82289
Early mesenchyme                71949
Excitatory neurons              68567
Epithelial cells                66209
Radial glia                     65428
Neural progenitor cells         58332
Postmitotic premature neurons   56033
Oligodendrocyte Progenitors     54606
Isthmic organizer cells         48498
Neural Tube                     45985
Inhibitory neurons              44658
Myocytes                        43197
Definitive erythroid lineage    34205
Chondroctye progenitors         33539
Inhibitory neuron progenitors   31214
Premature oligodendrocyte       29538
Limb mesenchyme                 26559
Sensory neurons                 26477
Endothelial cells               26431
Stromal cells                   23259
Osteoblasts                     23223
Schwann cell precursor          23145
Granule neurons                 16131
Notochord cells                 15481
Primitive erythroid lineage     15138
Inhibitory interneurons         13533
Hepatocytes                     11229
White blood cells                9202
Ependymal cell                   8566
Cholinergic neurons              7060
Cardiac muscle lineages          4867
Megakaryocytes                   3572
Melanocytes                      2827
Lens                             1954
Neutrophils                       506

Total number of cells in downsampled view

In [6]:
cell_type_dist.sum().get_values()[0]
Out[6]:
1386587

Visualize Downsampled Data

In [7]:
net.load_df(df_ds)
net.filter_N_top(inst_rc='row', N_top=250, rank_type='var')
net.normalize(axis='row', norm_type='zscore')
net.clip(-5,5)
net.widget()

Visualize Specific Cell Type Data

In [8]:
inst_cell_type = 'Sensory neurons'
In [9]:
net.load_df(df_ds)
net.filter_cat(axis='col', cat_index=1, cat_name='Cell Type: ' + inst_cell_type)
net.filter_N_top(inst_rc='row', N_top=250, rank_type='var')
net.normalize(axis='row', norm_type='zscore')
net.clip(-5,5)
net.widget()
In [ ]: